package com.softserveinc.interactive_board.validators.form;

import javax.validation.constraints.Max;
import javax.validation.constraints.Min;
import javax.validation.constraints.Pattern;
import javax.validation.constraints.Size;

import org.hibernate.validator.constraints.NotEmpty;

import com.softserveinc.interactive_board.domain.User;


public class EditUserForm {
	
	public EditUserForm(Long id, String login, String password, int userTypeId) {
		super();
		this.id = id;
		this.login = login;
		this.password = password;
		this.userTypeId = userTypeId;
	}
	
	public EditUserForm(final User user) {
		super();
		this.id = user.getId();
		this.login = user.getLogin();
		this.password = user.getPassword();
		this.userTypeId = user.getUserType().getId();
	}
	
	public EditUserForm() {
		this(new Long(0), "login", "password", 2);
	}
	
	private Long id;

	@NotEmpty
	@Size(max = 20)
	@Pattern(regexp = "([A-Z]|[a-z])([A-Z]|[a-z]|[0-9])*")
	private String login;
	
	@NotEmpty
	@Size(max = 20)
	@Pattern(regexp = "([A-Z]|[a-z])([A-Z]|[a-z]|[0-9])*")
	private String password;
	
	@Min(0)
	@Max(3)
	private int userTypeId;

	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public String getLogin() {
		return login;
	}

	public void setLogin(String login) {
		this.login = login;
	}

	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	public int getUserTypeId() {
		return userTypeId;
	}

	public void setUserTypeId(int userTypeId) {
		this.userTypeId = userTypeId;
	}

}
